package cn.wolfcode.crm.shiro.config;


import com.jagregory.shiro.freemarker.ShiroTags;
import freemarker.template.Configuration;
import freemarker.template.TemplateException;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import java.io.IOException;

public class MyFreeMarkerConfigurer extends FreeMarkerConfigurer {
    @Override
    public void afterPropertiesSet() throws IOException, TemplateException {
        super.afterPropertiesSet();
        Configuration configuration = getConfiguration();
        // 在Freemarker中注册shiro标签库,前缀为shiro
        // 在Freemarker中使用<@shiro.xxx>调用
        configuration.setSharedVariable("shiro",new ShiroTags());
    }
}
